#ifndef _DevicesSPI_H_
#define _DevicesSPI_H_


#define SPI1_NSS_SET_HIGH()                 GPIO_SetBits(GPIOB, GPIO_Pin_15)
#define SPI1_NSS_SET_LOW()                  GPIO_ResetBits(GPIOB, GPIO_Pin_15)


void vSPI1Init(void);
void vSPI2Init(void);

#define ucSPI1WriteReadByte(ucByte)         ucSPIWriteReadByte(SPI1, (ucByte))
#define cSPI1WriteDatas(pBuffer, iLength)   cSPIWriteDatas(SPI1, (pBuffer), (iLength))
#define cSPI1ReadDatas(pBuffer, iLength)    cSPIReadDatas(SPI1, (pBuffer), (iLength))

#define ucSPI2WriteReadByte(ucByte)         ucSPIWriteReadByte(SPI2, (ucByte))
#define cSPI2WriteDatas(pBuffer, iLength)   cSPIWriteDatas(SPI2, (pBuffer), (iLength))
#define cSPI2ReadDatas(pBuffer, iLength)    cSPIReadDatas(SPI2, (pBuffer), (iLength))

uint8_t ucSPIWriteReadByte(SPI_TypeDef *SPIx, uint8_t ucByte);
int8_t cSPIWriteDatas(SPI_TypeDef *SPIx, void *pvBuff, int32_t iLength);
int8_t cSPIReadDatas(SPI_TypeDef *SPIx, void *pvBuff, int32_t iLength);


#endif
